package Visao;

import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import java.awt.Color;
import javax.swing.JLabel;
import java.awt.Font;
import javax.swing.JTextField;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.JPasswordField;
import javax.swing.ImageIcon;

public class Login extends JFrame {

	private JPanel contentPane;
	private JTextField textFieldLogin;
	private JPasswordField textFieldSenha;
	private JButton btnEntrar;
	private ControleDeTelas telas;
	


	/**
	 * Launch the application.
	 */
	
	/**
	 * Create the frame.
	 */
	public Login() {
		telas = new ControleDeTelas();
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 405, 228);
		contentPane = new JPanel();
		contentPane.setBackground(Color.WHITE);
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);
		setLocationRelativeTo(null);
		
		JLabel lblLogin_1 = new JLabel("LOGIN");
		lblLogin_1.setForeground(Color.BLACK);
		lblLogin_1.setFont(new Font("Tahoma", Font.PLAIN, 17));
		lblLogin_1.setBounds(155, 38, 86, 14);
		contentPane.add(lblLogin_1);
		
		textFieldLogin = new JTextField();
		textFieldLogin.setForeground(Color.BLUE);
		textFieldLogin.setBounds(251, 35, 86, 20);
		contentPane.add(textFieldLogin);
		textFieldLogin.setColumns(10);
		
		JLabel lblSenha = new JLabel("SENHA");
		lblSenha.setForeground(Color.BLACK);
		lblSenha.setFont(new Font("Tahoma", Font.PLAIN, 17));
		lblSenha.setBounds(155, 107, 86, 14);
		contentPane.add(lblSenha);
		
		textFieldSenha = new JPasswordField();
		textFieldSenha.setBounds(251, 104, 86, 20);
		contentPane.add(textFieldSenha);
		textFieldSenha.setColumns(10);
		
		btnEntrar = new JButton("ENTRAR");
		btnEntrar.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				if(textFieldLogin.getText().equals("teste") && textFieldSenha.getText().equals("123456") ){
					telas.getInicio().setVisible(true);
					dispose();
				}else{
					JOptionPane.showMessageDialog(null, "Login ou Senha incorreto!!");
				}
			}
		});
		btnEntrar.setBounds(279, 167, 91, 23);
		contentPane.add(btnEntrar);
		
		JPanel panel = new JPanel();
		panel.setBackground(new Color(0, 128, 128, 150));
		panel.setBounds(145, 24, 203, 111);
		contentPane.add(panel);
		
		JLabel lblNewLabel = new JLabel("New label");
		lblNewLabel.setIcon(new ImageIcon("H:\\workspace\\SupportWatchful\\Imagens\\php1.jpg"));
		lblNewLabel.setBounds(0, 0, 397, 201);
		contentPane.add(lblNewLabel);
	}
}
